package book_management.operation.impl;

import book_management.book.BookList;
import book_management.operation.IOperation;

public class ReturnOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("您现在进行的是还书操作~");
        System.out.println("请输入您要还的书籍名称:");
        String booksName = scanner.next();
        // 判断该书在图书馆中是否存在
        if (bookList.isContains(booksName)) {
            // 书图书馆有，判断借出状态
            if (bookList.isBookBorrowed(booksName)) {
                bookList.returnBook(booksName);
                System.out.println("还书成功~");
            }else {
                System.err.println("该书您就没借，还啥还!");
            }

        }else {
            System.err.println("该书不存在~");
        }
    }
}
